<?php
namespace App\Repositories;

use Dingo\Api\Exception\ResourceException;
use Gregwar\Captcha\CaptchaBuilder;
use House;

class CaptchaRepository implements HouseRepositoryInterface {

    public function key()
    {
        return 1;
        $captchaBuilder = new  CaptchaBuilder();
        $addMinutes = config('app.captcha_addMinutes');
        $key = 'captcha-'.str_random(15);
        $captcha = $captchaBuilder->build();
        $expiredAt = now()->addMinutes($addMinutes);
        \Cache::put($key, ['code' => $captcha->getPhrase()], $expiredAt);

        $result = [
            'captcha_key' => $key,
            'expired_at' => $expiredAt->toDateTimeString(),
            'captcha_image_content' => $captcha->inline()
        ];
        return $result;
    }

}